#include "print.h"

//0x5000~0x6000
#ifdef ISBIOS
#define POS 0x5000
#define uartStream ( *( (struct Stream*)(BIOSRAM + POS + 0x00) ) )
#else
struct Stream uartStream;
#endif

int uartgetc(struct Stream* s){
  return uart_read();
}

void uartputc(struct Stream* s, int val){
  uart_write(val);
}

void uartputcgb(struct Stream* s, int v1, int v2){
  uart_write(v1);
  uart_write(v2);
}

int stdioInit(int p0){
  uartStream.getc = uartgetc;
  uartStream.putc = uartputc;
  uartStream.putcgb = uartputcgb;
  setDefaultStream(&uartStream);
  uart_irq_init();
}
